home *** CD-ROM | disk | FTP | other *** search
- ********************************************************************************************************
- ** Written by Dino Papararo 7-March-2001
- **
- ** FUNCTION
- **
- ** JuliaPPC -- perform Z = Z^2 + C iteration.
- **
- ** SYNOPSIS
- **
- ** ULONG JuliaPPC (ULONG Iterations,long double Cre,long double Cim,long double JKre,long double JKim)
- **
- **
- ** This function tests if a point belongs or not at Julia set
- **
- ** Optimized for pipelines of PPC processors.
- **
- ** r3:Iterations
- ** f1:Cre/Zr f2:Cim/Zi f3:JKre f4:JKim f5:Tmp1/Zr2 f6:Tmp2/Zi2 f7:Dist f8:MaxDist
- ********************************************************************************************************
-
-
- include powerpc/ppcmacros.i
- include powerpc/powerpc.i
-
- xref _PowerPCBase
-
- xdef _JuliaPPC
-
- section code
-
- cpu POWERPC
-
- _JuliaPPC
-
- prolog ; start
-
- lf f8,Radius ; MaxDist = Radius
-
- mtctr r3 ; Load Iterations into counter
-
- **************************************************************************
- * Dino Papararo Julia PPC ASM function fastest I have ever seen and
- * without any pipeline wait state for the maximu speeeeed possible on PPC.
- * Based on the HAAGE&PARTNER MandelBrot code.
- **************************************************************************
- *
- * fsub f8,f8,f3 ; MaxDist = Radius - JKre
- *.Loop
- * fmsub f6,f2,f2,f3 ; Tmp2 = Zi^2 - JKre
- * fadd f5,f1,f1 ; Tmp1 = 2 * Zr
- * fmadd f7,f1,f1,f6 ; Dist = Zr^2 + Tmp2
- * fmsub f1,f1,f1,f6 ; Zr = Zr^2 - Tmp2
- * fmadd f2,f2,f5,f4 ; Zi = Tmp1 * Zi + JKim
- * fcmpu f7,f8 ; if Dist > MaxDist and
- * bdnzf+ GT,.Loop ; Iterations != 0 goto Loop
- *************************************************************************
- * Dino Papararo Julia PPC ASM function for rendering Mandelbrot set a
- * bit slower than HAAGE&PARTNER based one but simplest, more elegant and
- * without any pipeline wait state too ;-)
- *
- .Loop
-
- fmul f6,f2,f2 ; zi2 = zi * zi
- fadd f2,f2,f2 ; zi = zi + zi
- fmadd f7,f1,f1,f6 ; dist = zr * zr + zi2
- fmsub f5,f1,f1,f6 ; zr = zr * zr - zi2
- fmadd f2,f1,f2,f4 ; zi = zr * zi + JKim
- fadd f1,f5,f3 ; zr += JKre
- fcmpu f7,f8 ; compare dist with radius
- bdnzf+ GT,.Loop ; if maxdist > radius or --iterations != 0 goto Loop
- *************************************************************************
-
- .End
-
- mfctr r3 ; Store Iterations from counter
-
- epilog ; end
-
- section data
-
- Radius dc.d 4.0